package com.portal.annotation.controller;

import com.portal.annotation.annotation.AutoLog;
import com.portal.annotation.aspect.BuildAspect;
import com.portal.annotation.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 日志控制器
 *
 * @author Amadeus
 * @date 2022/09/08
 */
@Slf4j
@Controller
@RequestMapping("/hello")
public class LogController {

    @GetMapping("/login/{name}")
    @AutoLog(methodName = "login")
    public User login(@PathVariable String name) {
        User user = BuildAspect.create();
        log.info("hello!" + name);
        return user;
    }

}
